package cn.wolfcode.p2p.business.service.impl;

import cn.wolfcode.p2p.Exception.ErrorCode;
import cn.wolfcode.p2p.business.domain.ExpAccount;
import cn.wolfcode.p2p.business.mapper.ExpAccountMapper;
import cn.wolfcode.p2p.business.service.IExpAccountService;
import cn.wolfcode.p2p.util.AssertUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ExpAccountServiceImpl implements IExpAccountService {
    @Autowired
    private ExpAccountMapper expaccountMapper;

    @Override
    public void update(ExpAccount expaccount) {
        AssertUtil.instance().isFalse(expaccountMapper.updateByPrimaryKey(expaccount) == 0, ErrorCode.FAILED_TO_CREATE_EXPERIENCE_ACCOUNT);
    }

    @Override
    public void save(ExpAccount expaccount) {
        expaccountMapper.insert(expaccount);
    }

    @Override
    public ExpAccount getExpAccount(Long id) {
        return expaccountMapper.selectByPrimaryKey(id);
    }
}
